#include <VisitorCollectGeode.h>
#include <SceneViewer.h>
#include <NodeInformationContainer.h>
#include <SceneViewerFunctions.h>
//#include <ObjectListGenerate.h>
#include <OsgClassDataSource/ObjectOsg.h>
#include <NodeInfoContainer.h>
#include <ClassFactoryObjectOsg.h>
#include <ClassFactoryObjectOsg.h>
#include <osg/ValueObject>
VisitorCollectGeode::VisitorCollectGeode()
{
	setTraversalMode(osg::NodeVisitor::TraversalMode::TRAVERSE_ALL_CHILDREN);
    setTraversalMask(0xffffffff);
    setNodeMaskOverride(0xffffffff);//travel all node
    m_collectionGroup = new osg::Group;
    m_count = 0;
}

VisitorCollectGeode::~VisitorCollectGeode()
{

}

void VisitorCollectGeode::apply(osg::Geode &node)
{
    m_collectionGroup->addChild(&node);
    node.setUserValue("geodeIndex", m_count);
    m_count++;
}

osg::ref_ptr<osg::Group> VisitorCollectGeode::getCollectionGroup()
{
    return m_collectionGroup;
}

void VisitorCollectGeode::clearCollectionGroup()
{
    m_collectionGroup = new osg::Group;
}
